<!DOCTYPE html>
<html class="x-admin-sm">

	<head>
		<meta charset="UTF-8">
		<title>欢迎页面-X-admin2.2</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<link rel="stylesheet" href="css/font.css">
		<link rel="stylesheet" href="css/xadmin.css">
		<script src="lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="js/xadmin.js"></script>
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
	</head>

	<body>
		
      <h1 id="status"></h1>
		  
     
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body ">
							<blockquote class="layui-elem-quote">欢迎管理员：
								<span class="x-red" id="n">test</span>！当前时间:2018-04-25 20:50:53
								
								
							</blockquote>
							
						</div>
						
					</div>
				</div>
		
				<div class="layui-col-md12" style="text-align: center;">
          <button class="layui-btn layui-btn-lg" style="margin-top: 0px;" id="qiandao2">签到</button>
          <button class="layui-btn layui-btn-lg  layui-btn-danger" style="margin-top: 0px;" id="qiantui">签退</button>
        </div>
			
		
			
				<style id="welcome_style"></style>
			</div>
		</div>

		<script src="js/User.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery.min.js" charset="utf-8"></script>
		<script type="text/javascript">
			$("#n").html(globalData.getUserName());
			//安全退出
			layui.use(['form'],function(){
         var form =layui.form,
         layer=layui.layer,
         $=layui.jquery;
         form.on('submit(login)',function(data){
           $.post(globalData.server+" ",$("#fmLogin").serialize(),function(res){
             if(res.success){
               console.log(res);
               globalData.setUserInfo(res.user.id);
             
             }else{
               layer.msg(res.Message,{
                 icon:2,
                 time:3000
               });
             }
           },"json");
           return false;
         });  
         //点击签到
       
        
        //签到
        $("#qiandao2").on('click', function() {
      $.post(globalData.server + 'qian/add2', {
        "signInName": globalData.getUid(),
        "statr": "已签到"
      }, function(data) {
        if(data.count > 0) {
          alert('签到成功');
          var index = parent.layer.getFrameIndex(window.name);
          parent.layer.close(index);
        } else {
          alert(data.msg);
        }
      }, "json");
    });
        
        
        //签退
         $("#qiantui").on('click', function() {
//      $.get(globalData.server + "askers/getstate", {
//        "Uid": globalData.getUid(),
//        "Checkstate": "已签到"
//      }, function(result) {
        $.post(globalData.server + 'qian/updates', {
          "signInName": globalData.getUid(),
          "statr": "已签退"
          //,"Checktime":layui.util.toDateString(result.data[0].Checktime, 'HH:mm:ss')
        }, function(data) {
          if(data.count > 0) {
            alert('签退成功');
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
          } else {
            alert(data.msg);
          }
        }, "json");
//      });
    });

         
       });
		</script>
	</body>

</html>